<template>
    <div>
            <van-nav-bar
                title="订单结算"
                left-text="返回"
                @click-left="onClickLeft"
                />
                <p class="img1"></p>
                <van-address-list
                    v-model="chosenAddressId"
                    :list="list"
                    default-tag-text="默认"
                    @edit="onEdit"
                    />
                    <div class="goodsinfo">
                                <p>
                                    <span>商品合计:</span>
                                    <span>￥{{price}}</span>
                                </p>
                                <p>
                                    <span>运费:</span>
                                    <span>免运费</span>
                                </p>
                                <p>
                                    <span>优惠券:</span>
                                    <span>暂无</span>
                                </p>
                    </div>
                    <div class="goodlist" v-for="item in goodslist" :key="item.id">
                            <van-card
                                :num="item.number"
                                :price="item.retail_price"
                                :title="item.goods_name"
                                :thumb="item.list_pic_url"
                                />
                </div>
                    <van-submit-bar :price="price*100" button-text="提交订单" @submit="onSubmit" />

                   
    </div>
               
</template>

<script>
import { oderlist} from "../../../api/my/index.js"
import { Toast } from 'vant';

    export default {
        data() {
            return {
                chosenAddressId:"",
                list:[],
                price:"",
                goodslist:[]


            }
        },
        methods:{
            onClickLeft(){
                this.$router.go(-1)
            },
            onEdit(){

            },
            onSubmit(){
                   Toast('支付功能暂未开放');
            }
        },
        created(){
            var openId = localStorage.getItem("openId")
            oderlist({
                    openId:openId
            }).then(res=>{
                console.log(res);
                res.address.tel =res.address.mobile
                res.address.isDefault = res.address.is_default
                this.price = res.allPrise
                this.list.push(res.address)
                this.goodslist = res.goodsList
            })
        }
    }
</script>

<style lang="scss" scoped>
* {
    margin: 0;
    padding: 0;
}
    .img1 {
        width: 100%;
        height: 8px;
        background: url("../../../../images/address-bg-bd.png");
      
    }
    .van-address-list__bottom {
        display: none;
    }
.van-radio__icon.van-radio__icon--round.van-radio__icon--checked{
        display: none!important;
    }
    .goodsinfo {
        width: 100%;
        height: 140px;
        margin-top: 5px;
         margin-bottom: 15px;
        

        p {
            display: block;
            width: 100%;
            height: 46px;
            color: #333;
            font-size: 14px;
            margin-top: 3px;
             box-sizing: border-box;
         padding: 10px;
            background-color: #fff;
            :nth-child(1){
                float: left;
                line-height: 46px;
            }
             :nth-child(2){
                float: right;
                line-height: 46px;
            }
        }
    }
    .goodlist {
        width: 100%;
        background-color: #fff;
        .van-card {
            margin-bottom: 5px;
        }
    }
</style>